package com.example.soft.demos.web;

public class NoEnoughPapersException extends Exception {
    private final String studentName;
    private final int preferredQuantity;
    private final int availablePapers;

    public NoEnoughPapersException(String studentName, int preferredQuantity, int availablePapers) {
        this.studentName = studentName;
        this.preferredQuantity = preferredQuantity;
        this.availablePapers = availablePapers;
    }

    @Override
    public String getMessage() {
        return "学生 " + studentName + " 希望选论文 " + preferredQuantity + " 篇，但目前只有 " + availablePapers + " 篇可选";
    }
}